package com.itheima.exception;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Component
@ControllerAdvice
public class ExceptionAdvice {


    @ExceptionHandler(BusinessException.class)
    public String doBusinessException(Exception ex){
        return ex.getMessage();
    }

    @ExceptionHandler(SystemException.class)
    public String doSystemException(Exception ex){
        return "抱歉~系统正忙";
    }

    @ExceptionHandler(Exception.class)
    public String doOtherException(Exception ex){
        return "不干了~";
    }


}
